// component/password/password.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    isnavigator:{
      type:Boolean,
      value:true
    },
    finsTotalprice:{
      type:String,
      value:0
    },
    token:{
      type:String,
      value:0
    },
    orderno:{
      type:String,
      value:0
    },
    onddid:{
      type:String,
      value:''
    },
    onamountnum:{
      type:String,
      value:''
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    focus: false,
    inputValue: '',
    ontrue:false,
    orderno:null,
  },

  /**
   * 组件的方法列表
   */
  methods: {
    /******关闭********/
    isTrue(e){
      let that = this;
      that.setData({
        isnavigator:false
      })
    },

    //获取密码的值
    bindKeyInput: function (e) {
      let that = this;
      console.log(that.properties)
      console.log(e.detail.value);
      this.setData({
        inputValue: e.detail.value
      })
    },
    okmoney(e){
      let that = this;
      let rate = that.properties
      let userInfo =  wx.getStorageSync('userInfo')
      //判断是否设置支付密码
      if(userInfo.hasPayPwd==false){
          //跳转到支付页面
          wx.navigateTo({
            url: '../scenter/editbaypasscode'
          })
      }
      //个人支付
      wx.request({
        url: 'https://www.yulonging.com/dwweb/wxapi.ashx',
        data: {
        cmd:'SetOrderPays',
         token:rate.token,
         orderno:rate.orderno,
         AccMoney:rate.finsTotalprice,
         officeId:1,
         AccCorp:0,
         PayPwd:rate.inputValue,
         PayMoney:0,
        //  PayMoney:rate.finsTotalprice,
         VocMoney:rate.onamountnum,
         VocID:rate.onddid,
        },
        method: "get",
        success(res) {
          if(res.data.STATUS=='Success'){
            wx.showToast({
              title: res.data.DESC,
              icon: 'success',
              duration: 2000
            })
            setTimeout(function(){
              let orderno = rate.orderno;
              that.setData({
                orderno:orderno,
                ontrue:true,
                isnavigator:false
              })
          },2000);
          }else{
            wx.showToast({
              title: res.data.DESC,
              icon: 'none',
              duration: 2000
            })
          }
        }
    })
    // that.setData({
     
    // })
     
    }
  }
})
